import BaseCommand from "@/core/Frame/BaseClass/BaseCommand"

class CloseWidgetCommand extends BaseCommand {
  widgetsManager: any

  constructor(params: any) {
    super()
    this.widgetsManager = params.widgetsManager
  }

  execute(option: any) {
    const paramter = option.paramter
    this.widgetsManager.inactivate(paramter.comName)
  }

  isEnable(option: any) {
    const paramter = option.paramter
    if (!paramter || paramter.comName == '') return false
    return !this.widgetsManager.hasActivateWidget(paramter.comName)
  }
}

export default CloseWidgetCommand